package node;

import lexer.LexType;
import parser.Parser;

import java.io.IOException;

public class ForStmtNode extends ASTNode {
    public final String name = "<ForStmt>";
    // ForStmt → LVal '=' Exp
    private final LValNode lValNode;
    private final ExpNode expNode;

    public ForStmtNode(LValNode lValNode, ExpNode expNode) {
        this.lValNode = lValNode;
        this.expNode = expNode;
    }

    public ExpNode getExpNode() {
        return expNode;
    }

    public LValNode getlValNode() {
        return lValNode;
    }

    @Override
    public void show() throws IOException {
        lValNode.show();
        Parser.parserWriter.write(LexType.ASSIGN + " " + "=" + "\n");
        expNode.show();
        Parser.parserWriter.write(name + "\n");
    }

}
